﻿// Creates a new object based on the current object.
// Relies on mapping tables to pre-populate the object
function locAddRelatedTo(iTypeToAdd) {
    locAddRelatedToPlusAdditional(iTypeToAdd, "");
}


// Creates a new object based on the current object.
// Relies on mapping tables to pre-populate the object
// pass in additional attributes with the format &<attributename=<value>[&<attributename=<value>...].
// ex: "&name=jim&address1_state=wa"
function locAddRelatedToPlusAdditional(iTypeToAdd, additionalAttributes) {
    locAddRelatedToNonForm(iTypeToAdd, crmFormSubmit.crmFormSubmitObjectType.value, crmFormSubmit.crmFormSubmitId.value, additionalAttributes);
}


// Creates a new object based on the current object
function locAddRelatedToNonForm(iTypeToAdd, createFromType, createFromId, additionalAttributes) {
    var sUrl = "?_CreateFromType=" + createFromType + "&_CreateFromId=" + createFromId + additionalAttributes
    openFrmObj(sUrl, buildWinName(), iTypeToAdd);
}


function locAddObjTo(iType) {
    openObjEx(iType, crmFormSubmit.crmFormSubmitObjectType.value, crmFormSubmit.crmFormSubmitId.value);
}